Object.defineProperty(exports, "__esModule", { value: !0 }),
  (exports.userLogOut =
    exports.putUpload =
    exports.postUser =
    exports.postUpdateUser =
    exports.postMobile =
    exports.postLogin =
    exports.getUser =
    exports.getCosAuth =
    exports.getAuthorize =
      void 0);
var e = a(require("../../@babel/runtime/regenerator")),
  t = require("../../@babel/runtime/helpers/asyncToGenerator"),
  r = a(require("@config/index")),
  n = a(require("../request")),
  u = require("../user-service");
function a(e) {
  return e && e.__esModule ? e : { default: e };
}
var s = new n.default(),
  o = r.default.isProdThird ? r.default.DOMAIN_PROD : r.default.DOMAIN_TEST;
(exports.postLogin = (function () {
  var r = t(
    e.default.mark(function t(r) {
      var n, u;
      return e.default.wrap(function (e) {
        for (;;)
          switch ((e.prev = e.next)) {
            case 0:
              return (
                (n = "".concat(o, "/usrv-center/api/v1/base/third-login")),
                (e.next = 3),
                s.post(n, r, {})
              );
            case 3:
              return (u = e.sent), e.abrupt("return", u);
            case 5:
            case "end":
              return e.stop();
          }
      }, t);
    }),
  );
  return function (e) {
    return r.apply(this, arguments);
  };
})()),
  (exports.getAuthorize = (function () {
    var r = t(
      e.default.mark(function t(r) {
        var n, a, c;
        return e.default.wrap(function (e) {
          for (;;)
            switch ((e.prev = e.next)) {
              case 0:
                return (
                  (n = "".concat(o, "/oauth/v1/code/oauth/authorize")),
                  (e.next = 3),
                  (0, u.getSKEY)()
                );
              case 3:
                return (
                  (a = e.sent), (e.next = 6), s.get(n, r, { "x-wii-token": a })
                );
              case 6:
                return (c = e.sent), e.abrupt("return", c);
              case 8:
              case "end":
                return e.stop();
            }
        }, t);
      }),
    );
    return function (e) {
      return r.apply(this, arguments);
    };
  })()),
  (exports.postMobile = (function () {
    var r = t(
      e.default.mark(function t(r) {
        var n, a, c;
        return e.default.wrap(function (e) {
          for (;;)
            switch ((e.prev = e.next)) {
              case 0:
                return (
                  (n = "".concat(
                    o,
                    "/usrv-center/api/v1/wx-app/authorize-mobile/new",
                  )),
                  (e.next = 3),
                  (0, u.getSKEY)()
                );
              case 3:
                return (
                  (a = e.sent), (e.next = 6), s.post(n, r, { "x-wii-token": a })
                );
              case 6:
                return (c = e.sent), e.abrupt("return", c);
              case 8:
              case "end":
                return e.stop();
            }
        }, t);
      }),
    );
    return function (e) {
      return r.apply(this, arguments);
    };
  })()),
  (exports.postUser = (function () {
    var r = t(
      e.default.mark(function t(r) {
        var n, a, c;
        return e.default.wrap(function (e) {
          for (;;)
            switch ((e.prev = e.next)) {
              case 0:
                return (
                  (n = "".concat(
                    o,
                    "/usrv-center/api/v1/wx-app/authorize-user-info",
                  )),
                  (e.next = 3),
                  (0, u.getSKEY)()
                );
              case 3:
                return (
                  (a = e.sent), (e.next = 6), s.post(n, r, { "x-wii-token": a })
                );
              case 6:
                return (c = e.sent), e.abrupt("return", c);
              case 8:
              case "end":
                return e.stop();
            }
        }, t);
      }),
    );
    return function (e) {
      return r.apply(this, arguments);
    };
  })()),
  (exports.postUpdateUser = (function () {
    var r = t(
      e.default.mark(function t(r) {
        var n, a, c;
        return e.default.wrap(function (e) {
          for (;;)
            switch ((e.prev = e.next)) {
              case 0:
                return (
                  (n = "".concat(o, "/usrv-center/api/v1/base/update")),
                  (e.next = 3),
                  (0, u.getSKEY)()
                );
              case 3:
                return (
                  (a = e.sent), (e.next = 6), s.post(n, r, { "x-wii-token": a })
                );
              case 6:
                return (c = e.sent), e.abrupt("return", c);
              case 8:
              case "end":
                return e.stop();
            }
        }, t);
      }),
    );
    return function (e) {
      return r.apply(this, arguments);
    };
  })()),
  (exports.getUser = (function () {
    var r = t(
      e.default.mark(function t() {
        var r, n, a;
        return e.default.wrap(function (e) {
          for (;;)
            switch ((e.prev = e.next)) {
              case 0:
                return (
                  (r = "".concat(o, "/usrv-center/api/v1/base/loginfo")),
                  (e.next = 3),
                  (0, u.getSKEY)()
                );
              case 3:
                return (
                  (n = e.sent), (e.next = 6), s.get(r, {}, { "x-wii-token": n })
                );
              case 6:
                return (a = e.sent), e.abrupt("return", a);
              case 8:
              case "end":
                return e.stop();
            }
        }, t);
      }),
    );
    return function () {
      return r.apply(this, arguments);
    };
  })()),
  (exports.userLogOut = (function () {
    var r = t(
      e.default.mark(function t() {
        var r, n, a;
        return e.default.wrap(function (e) {
          for (;;)
            switch ((e.prev = e.next)) {
              case 0:
                return (
                  (r = "".concat(o, "/usrv-center/api/v1/base/logout")),
                  (e.next = 3),
                  (0, u.getSKEY)()
                );
              case 3:
                return (
                  (n = e.sent),
                  (e.next = 6),
                  s.delete(r, {}, { "x-wii-token": n })
                );
              case 6:
                return (a = e.sent), e.abrupt("return", a);
              case 8:
              case "end":
                return e.stop();
            }
        }, t);
      }),
    );
    return function () {
      return r.apply(this, arguments);
    };
  })()),
  (exports.getCosAuth = (function () {
    var r = t(
      e.default.mark(function t() {
        var r, n, a;
        return e.default.wrap(function (e) {
          for (;;)
            switch ((e.prev = e.next)) {
              case 0:
                return (
                  (r = "".concat(
                    o,
                    "/usrv-center/api/v1/base/avatar/upload-url",
                  )),
                  (e.next = 3),
                  (0, u.getSKEY)()
                );
              case 3:
                return (
                  (n = e.sent), (e.next = 6), s.get(r, {}, { "x-wii-token": n })
                );
              case 6:
                return (a = e.sent), e.abrupt("return", a);
              case 8:
              case "end":
                return e.stop();
            }
        }, t);
      }),
    );
    return function () {
      return r.apply(this, arguments);
    };
  })()),
  (exports.putUpload = (function () {
    var r = t(
      e.default.mark(function t(r, n) {
        var a, o;
        return e.default.wrap(function (e) {
          for (;;)
            switch ((e.prev = e.next)) {
              case 0:
                return (e.next = 2), (0, u.getSKEY)();
              case 2:
                return (
                  (a = e.sent),
                  (e.next = 5),
                  s.put(r, n, { "x-wii-token": a, "Content-Type": "image/png" })
                );
              case 5:
                return (o = e.sent), e.abrupt("return", o);
              case 7:
              case "end":
                return e.stop();
            }
        }, t);
      }),
    );
    return function (e, t) {
      return r.apply(this, arguments);
    };
  })());
